<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN">

<html>
  <head>
    <base href="<%=basePath%>">
    <title>移动巡检</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="<%=basePath%>js/jquery/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/jquery/jquery.cookie.js"></script>   
	<style>
		* {
			margin:0 auto;
			padding:0px;
		}
		body {
			margin:0 auto;
			padding:0px;
			font-size:12px;
			font-family:Verdana, Arial, Helvetica, sans-serif;
		}
		#login_warp {
			width:1002px;
			margin:0px auto;
		}
		.login_logo {
			width:997px;
			height:78px;
			float:left;
			padding:80px 0px 30px 5px;
		}
		.login_bg {
			width:1002px;
			height:412px;
			float:left;
			background:url(images/login_bg1.jpg) no-repeat;
			position:relative;
		}
		.login_box {
			width:300px;
			height:300px;
			top:30px;
			right:25px;
			position:absolute;
		}
		.login_title {
			width:300px;
			height:50px;
			float:left;
			color:#004080;
			font-size:18px;
			text-align:center;
			padding-top:15px;
			font-family:"微软雅黑";
			margin-bottom:20px;
		}
		.login_con {
			width:278px;
			float:left;
			padding-left:23px;
			color:#FFFFFF;
		}
		.login_account {
			width:254px;
			height:34px;
			float:left;
			margin-bottom:25px;
		}
		.login_text {
			width:210px;
			height:29px;
			line-height:25px;
			margin-bottom:20px;
			background:url(images/input1.gif) no-repeat;
			border:0px;
			padding:5px 0px 0px 44px;
		}
		.login_pass {
			width:210px;
			height:29px;
			line-height:25px;
			margin-bottom:20px;
			border:0px;
			background:url(images/input2.gif) no-repeat;
			padding:5px 0px 0px 44px;
		}
		.login_rem {
			width:190px;
			float:left;
			padding-left:77px;
			color:#000000;
			font-size:14px;
		}
		.login_rem a {
		color:#000000;
		font-size:14px;
		}
		.logo_button {
			width:259px;
			float:left;
			padding:26px 0px 0px 31px;
		}
		.input_button {
			width:240px;
			height:37px;
			float:left;
			cursor:pointer;
			border:0px;
			background:url(images/logo_button.gif) no-repeat;
		}
	</style>
	<script type="text/javascript">
			$(document).ready(function (){ 
				
				if ($.cookie("save") == "true") { 
				document.getElementById("save").checked = true ;
				$("#username").val($.cookie("userName")); 
				$("#password").val($.cookie("passWord")); 
				} 
			});
			function download(){
				window.location.href = "<%=basePath %>1.chm";
			}
			function doForm(){
			 var username = document.getElementById("username");
			 var password = document.getElementById("password");
			if(username.value == ""){
				alert("请输入用户名");
				username.focus();
				return false;
			}
			if(password.value == ""){
				alert("请输入密码");
				password.focus();
				return false;
			}
			saveUserInfo();
			if(!document.getElementById("username").value){
				alert('请输入用户名');
				return ;
			}
			if(!document.getElementById("password").value){
				alert('请输入密码');
				return ;
			}
			document.getElementById("frm").submit();
			}
			var result  = '';
			if(result){
			alert(result);
			}

		//保存用户信息 
		function saveUserInfo() { 
		if (document.getElementById("save").checked) { 
		var userName = $("#username").val(); 
		var passWord = $("#password").val(); 
		$.cookie("save", "true", { expires: 7 }); // 存储一个带7天期限的 cookie 
		$.cookie("userName", userName, { expires: 7 }); // 存储一个带7天期限的 cookie 
		$.cookie("passWord", passWord, { expires: 7 }); // 存储一个带7天期限的 cookie 
		} 
		else { 
		$.cookie("save", "false", { expires: -1 }); 
		$.cookie("userName", "", { expires: -1 }); 
		$.cookie("passWord", "", { expires: -1 }); 
		} 
		}
		var result  = '<%=session.getAttribute("resultString") == null ?"":session.getAttribute("resultString")%>';
			if(result){
			alert(result);
			}
			<%session.setAttribute("resultString","");%>
		</script>
  </head>
  
  <body>
  <div id="login_warp">
<form id = "frm" action="<%=basePath %>login/login.xhtml" method = "post" >
  <div class="login_logo"><img alt="" src="<%=basePath%>images/logo1.jpg" /></div>
    <div class="login_bg">

    	<div class="login_box">
        	<div class="login_title">系统登录</div>
            <div class="login_con">
           	  <div class="login_account"><input name="username" id="username" type="text" class="login_text" /></div>
              <div class="login_account"><input name="password" id="password" type="password" class="login_pass" /></div>
            </div>
            <div class="login_rem" align="right" > <a style="cursor: pointer" href = "<%=basePath %>upload/fileVersion/soft.apk"  >下载软件</a>

</div>
            <div class="logo_button"><a href="#" onclick = "doForm()" ><input type="submit" name="" value="" class="input_button" /></a></div>
        </div><!--login_box emd-->
    </div>
   </form>
</div>
  </body>
</html>
